<template>
    <receiptInfo v-if="showPage" :fullscreenShow="true" />
</template>

<script>
import receiptInfo from "./receiptInfo.vue"
import { getPrjDetailApi, getShortTokenApi } from '@/api/acceptance/index'
import { transferTokenPost } from "@/api/businessOperation/index"
export default {
    name: "receiptInfoPage",
    components: { receiptInfo },
    provide() {
        return {
            prjDetail: () => this.prjDetail,
            workDetail: () => this.workDetail,
        }
    },
    data() {
        return {
            prjDetail: {},
            workDetail: {
                bizObject: {}
            },
            showPage: false
        }
    },
    methods: {
        async getPrjDetail(id) {
            const res = await getPrjDetailApi(id)
            this.prjDetail = res.data
            this.showPage = true
        }
    },
    async created() {
        const { prjId, acctId, pwdaToken } = this.$route.query;
        const params = { acctId: acctId, token: pwdaToken }
        // 获取token 
        const res = await transferTokenPost(params)
        if (+res.code === 200) {
            window.sessionStorage.setItem('china-tower-token-pms20', res.data)
            if (prjId) {
                this.getPrjDetail(prjId)
            }
        }

    },
}

</script>
<style scoped></style>